Learn how to send files to a remote server.
Checkout the project Lab05 from your svn repository (svn update
should
do the trick if you checked out your entire repository in Lab01). Write
your solutions to the problem below in that folder.
Modify your previous lab assignment (Lab04) to handle PUT
file requests,
in addition to the GET
and ECHO
requests.
For this assignment assume that all packets are sent correctly. The name of
the file should be sent in the data
field of the PUT
request. The server
will create a file with that name and fill it with the data packets you send.
In order to make sure that the server is willing to process the PUT
request, you should wait until the server sends an ACK
before starting to
send any packets of data. The server will acknowledge each fifth DATA
packet. Remember to send an ACK
after transmitting all the file packets.
The server will send a final ACK
to end the file transfer.
Here is a typical scenario. The numbers are the sequence numbers in the packets:
Client Server
------ ------
PUT ----------->
<----------- ACK 0
DATA 0 ----------->
DATA 1 ----------->
DATA 2 ----------->
DATA 3 ----------->
DATA 4 ----------->
<----------- ACK 4
DATA 5 ----------->
ACK 5 ----------->
<----------- ACK 5
The server programs are available in the Lab05/SERVER folder in your repository.
You should start with your solution to Lab04.
Compile and run the programs in the Linux environment.
Use a consistent set of coding standards. The GNU C coding standards are available at http://www.gnu.org/prep/standards/standards.html#Writing-C Sections to look at are "Comments", "Formatting", "Syntatic Conventions", and "Names".
Submit the source files (.c), the header files (.h) and the Makefile to your svn repository.